package com.zmq.pic.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.GenericGenerator;

/**
 * 角色菜单映射 entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "pic_role_menu", uniqueConstraints = @UniqueConstraint(columnNames = {
		"MENU_ID", "ROLE_ID" }))
public class PicRoleMenu implements java.io.Serializable {

	private static final long serialVersionUID = 503448213744563622L;
	// Fields

	private Long id;
	private PicMenu picMenu;
	private PicRole picRole;

	// Constructors

	/** default constructor */
	public PicRoleMenu() {
	}

	/** full constructor */
	public PicRoleMenu(PicMenu picMenu, PicRole picRole) {
		this.picMenu = picMenu;
		this.picRole = picRole;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "ID", nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "MENU_ID", unique = true)
	public PicMenu getPicMenu() {
		return this.picMenu;
	}

	public void setPicMenu(PicMenu picMenu) {
		this.picMenu = picMenu;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ROLE_ID", unique = true)
	public PicRole getPicRole() {
		return this.picRole;
	}

	public void setPicRole(PicRole picRole) {
		this.picRole = picRole;
	}

	@Override
	public String toString() {
		return "PicRoleMenu [id=" + id + ", picMenu=" + picMenu + ", picRole="
				+ picRole + "]";
	}

}